package com.zengqingfa.config;

import com.zengqingfa.controller.HelloController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author zengqingfa
 * @className HelloAutoConfitguration
 * @description
 * @create 2022/6/14 21:59
 */
@Configuration
@ConditionalOnProperty(value = "hello.name")
@EnableConfigurationProperties(HelloProperties.class)
public class HelloAutoConfitguration {

    @Autowired
    HelloProperties helloProperties;

    @Bean
    public HelloController indexController(){
        return new HelloController(helloProperties);
    }
}